﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using GJ_Model.Factory;
using GJ_Model.Interface;

namespace ProjectTest
{
    public partial class GJ_MainForm : Form
    {
        /// <summary>
        /// 公交查询接口
        /// </summary>
        IGJ_Model_OperationOper gjOper = GJ_Model_Factory.CreateGJ_Model_OperationOper();
        Dictionary<string, string[]> GJNameData;
        Dictionary<string, string[]> GJStationData;
        public GJ_MainForm()
        {
            InitializeComponent();
        }

        private void btnSelect_Click(object sender, EventArgs e)
        {
            BindGrid();
        }

        private void GJ_MainForm_Load(object sender, EventArgs e)
        {
            try
            {
                GJStationData=new Dictionary<string,string[]>();
                GJNameData = gjOper.GetAllData(out GJStationData);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        /// <summary>
        /// 查询
        /// </summary>
        private void Select()
        {
            try
            { }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        /// <summary>
        /// 绑定列表
        /// </summary>
        private void BindGrid()
        {
            try
            {
                DataTable dtGrid = gjOper.GetDataTableAll();
                this.gvResult.DataSource = dtGrid;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
    }
}
